package com.samba.entites;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * cet entity permet de gerer toutes les transactions lie a un utisateur(preteur , entrepreneur)
 * 
 * @author samba
 * 
 */

@Entity
@Table(name = "TABLE_TRANSACTION")
public class Transaction {

	/**
	 * Transaction Type Enumeration
	 */
	public enum TransactionType {
		DEBIT, CREDIT
	}

	private int id;
	private String numeroDuCompte;

	private TransactionType type;

	private Date date;

	private double value;

	public Transaction() {
		// la transaction prend par defaut la date du jours(date systeme)
		date =new Date();
	}

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	@Column(nullable=false)
	public String getNumeroDuCompte() {
		return numeroDuCompte;
	}

	public void setNumeroDuCompte(String numeroDuCompte) {
		this.numeroDuCompte = numeroDuCompte;
	}

	@Column(nullable= false)
	public TransactionType getType() {
		return type;
	}

	public void setType(TransactionType type) {
		this.type = type;
	}
	
	@Temporal(TemporalType.TIMESTAMP)
	public Date getDate() {
		return date;
	}

   @Column(nullable = false)
	public void setDate(Date date) {
		this.date = date;
	}

	public double getValue() {
		return value;
	}
	public void setValue(double value) {
		this.value = value;
	}	
}
